package jmu.cyxwcy.librarymanagement.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import jmu.cyxwcy.librarymanagement.pojo.Admin;
import jmu.cyxwcy.librarymanagement.pojo.Book;
import jmu.cyxwcy.librarymanagement.pojo.Students;
import jmu.cyxwcy.librarymanagement.mapper.StudentsMapper;
import jmu.cyxwcy.librarymanagement.service.IStudentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2024-06-25
 */
@Service
public class StudentsServiceImpl extends ServiceImpl<StudentsMapper, Students> implements IStudentsService {
    @Autowired
    private StudentsMapper studentsMapper;

    @Override
    public Students findByUserName(String username) {
        Students student= studentsMapper.findByUserName(username);
        return student;
    }

    @Override
    public IPage<Students> join(IPage<Students> page, MPJLambdaWrapper<Students> queryWrapper) {
        return studentsMapper.selectJoinPage(page, Students.class, queryWrapper);
    }

    @Override
    public Students joinInfo(MPJLambdaWrapper<Students> queryWrapper) {
        return studentsMapper.selectOne(queryWrapper);
    }

    @Override
    public void resetPassword(Integer studentId, String md5String) {
        studentsMapper.resetPassword(studentId,md5String);
    }
}
